package com.bw.controller;

import com.bw.entity.Zxt;
import com.bw.mapper.ZxtMapper;
import org.spring.kun.common.ExcelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@Controller
public class ZztController {


    @Autowired
    ZxtMapper zxtMapper;

    @RequestMapping("/zxtPage.do")
    public String zztPage(){

        return "zxt";
    }
    @RequestMapping("/zxt.do")
    @ResponseBody
    public List<Zxt> zxt(Integer yesterday){

        return  zxtMapper.zxt(yesterday);
    }
    @RequestMapping("/excel.do")
    public void excel(Integer yesterday, HttpServletResponse response){

        List<Zxt> list = zxtMapper.zxt(yesterday);

        ExcelUtils.exportExcel(list,"文件名","sheet1",response);
    }
}
